//
// Created by ole on 24-8-17.
//

#ifndef EVENTMANAGER_H
#define EVENTMANAGER_H
#include <memory>

#include "IPCProxy.h"
#include "MessageReceiver.h"
#include "Topic.h"
#include "../../utils/Log.h"


class IPCManager {
public:
    std::string TAG = "IPCManager";

    bool start() {
        Log::i(TAG, "Starting.");
        return ipcProxy.start();
    }

    bool stop() {
        Log::i(TAG, "Stopping.");
        return ipcProxy.stop();
    }

    void subscribe(const std::shared_ptr<Topic> &topic, const std::shared_ptr<MessageReceiver> &receiver) {
        ipcProxy.subscribe(topic, receiver);
    }

    void unsubscribe(const std::shared_ptr<Topic> &topic, const std::shared_ptr<MessageReceiver> &receiver) {
        ipcProxy.unsubscribe(topic, receiver);
    }

    void publishMessage(const std::shared_ptr<Message> &msg) {
        ipcProxy.publishMessage(msg);
    }

    void loopForever() {
        ipcProxy.loopForever();
    }

private:
    IPCProxy ipcProxy;
};


#endif //EVENTMANAGER_H
